package com.easyhouse.common.pojo;

import com.easyhouse.common.utils.TimeUtils;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ProductR {
    //根据驼峰命名定义属性

    private String  houseId;
    private String  houseName;
    //封装类完成基本类型的使用
    //满足业务意义
    private String  houseType;
    private double  houseArea;
    private double  productPrice;
    private String  houseAddr;
    private String  addrProvince;
    private String  addrDistrict;
    private String  imgUrl; //http://image.jt.com/&(&*&
    private Integer sellStatus;
    private String userId;
    private String consumerId;
    private String houseDescription;
    private String startTime;
    private String  extend;

    public  Product toProduct(){
        return Product.builder()
                .houseId(this.houseId)
                .houseName(this.houseName)
                .houseType(this.houseType)
                .houseArea(this.houseArea)
                .productPrice(this.productPrice)
                .houseAddr(this.houseAddr)
                .addrProvince(this.addrProvince)
                .addrDistrict(this.addrDistrict)
                .imgUrl(this.imgUrl)
                .sellStatus(this.sellStatus)
                .userId(this.userId)
                .consumerId(this.consumerId)
                .houseDescription(this.houseDescription)
                .startTime(TimeUtils.getTime(this.startTime))
                .extend(this.extend)
                .build();
    }
}
